package thread;

public class MyThread implements Runnable{
	public void run(){
		try{
			while(!Thread.currentThread().isInterrupted()){
			System.out.println("T스레드 실행중");
			Thread.sleep(500);
			}
		}catch(InterruptedException e){
			
		}finally{
			System.out.println("스레드가 종료되었습니다.");
		}
	}
	
	
	public static void main(String[] args) {
		MyThread mh = new MyThread();
		Thread th = new Thread(mh);
		th.start();
		try{
			Thread.sleep(2000);
		}catch(InterruptedException e){
			e.printStackTrace();
		}
		th.interrupt();
	}	
}
